class Solution:
    def sortColors(self, nums: List[int]) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        
        # 荷兰三色旗问题解
        # 注意对非0、1、2的数据做排除处理

        result=[0,0,0]
        for i in range(len(nums)):
            if(nums[i]>=0 and nums[i]<3):
                result[nums[i]]+=1
            else:
                print('error')
        index=0
        for i in range(result[0]):
            nums[index]=0
            index+=1
        for i in range(result[1]):
            nums[index]=1
            index+=1
        for i in range(result[2]):
            nums[index]=2
            index+=1
        return nums


        

